interface IProduct {
  show: () => void
}

class IFactory {
  makeProduct: () => IProduct
}

class Car1 implements IProduct {
  show() {
    console.log('Car1');
  };
}

class Motor1 implements IProduct {
  show() {
    console.log('Motor1');
  }
}

class Bicycle {
  show() {
    console.log('Motor1');
  }
}

class CarFactory implements IFactory {
  makeProduct() {
    return new Car1()
  }
}

class MotorFactory implements IFactory {
  makeProduct() {
    return new Motor1()
  }
}


const car1Factory = new CarFactory()
const car1 = car1Factory.makeProduct()
car1.show()


const motor1Factory = new MotorFactory()
const motor1 = motor1Factory.makeProduct()
motor1.show()